TARGET= ../../bin/raft10
CFLAGS := -Wall -w  -g -ggdb -O0 -Wno-unused -Wno-sign-compare -Wno-deprecated-declarations -Wno-deprecated -Wl,--no-as-needed -std=c++17 \
-I /usr/local/include/ -I ../../src/ -I ../../ -I ../../third_party/ -I ../../third_party/rocksdb/ -I ../../third_party/rocksdb/include/
cppfiles := $(shell ls *.cc)
cfiles := $(-shell ls *.cc)
OBJS := $(patsubst %.cc,./%.o, $(cppfiles) $(cfiles))
COBJS=${patsubst %.cc,./%.o,$(cfiles)}
CXXOBJS=${patsubst %.cc,./%.o,$(cppfiles)}

DEPS=$(patsubst %.o,%.d,$(OBJS))

LIB= ../../lib/libraft.a ../../lib/libzrpc.a  ../../third_party/rocksdb/librocksdb.a ../../lib/libslash.a

SO_LIB= 


.PHONY: all clean

all: ${TARGET}

${TARGET}: ${OBJS} ${LIB} 
	g++ -o $@ $^ ${LDFLAGS}${LIB} ${LIB64}  -lpthread -lprotobuf -lstdc++fs -ldl -lzstd -lbz2 -lz -lsnappy -llz4 #-lz #-lsnappy
${CXXOBJS}:./%.o:./%.cc
	g++ -MMD -c -o $@ $< ${CFLAGS} 

${COBJS}:./%.o:./%.cc
	${CC} -MMD -c -o $@ $< ${CFLAGS} 

-include $(DEPS)

clean:
	rm -rf ${OBJS} ${TARGET} ${DEPS}
	rm -rf ../../bin/raft1_example/
show:
	@echo GPROF=$(GPROF)
	@echo CFLAGS=$(CFLAGS)
	@echo LDFLAGS=$(LDFLAGS)
	@echo objs=$(OBJS)
	@echo cppfiels=$(cppfiles)
	@echo cfiels=$(cfiles)
	@echo DEPS=$(DEPS)
	@echo CXXOBJS=$(CXXOBJS)
	@echo COBJS=$(COBJS)

